//
//  CSSWViewController.m
//  Hxcsfw
//
//  Created by qiysoft on 2017/12/27.
//  Copyright © 2017年 企友软mac. All rights reserved.
//

#import "CSSWViewController.h"
#import "CouseSeachListView.h"
#import "AnswerSortListViewController.h"

@interface CSSWViewController ()<CouseSeachListViewDelegate>
{
    CouseSeachListView *seachView;
    int m;
    int n;
}
@property (nonatomic,copy) NSString *level1;
@property (nonatomic,copy) NSString *level2;
@property (nonatomic,copy) NSString *level3;
@property (nonatomic,strong) NSArray *CSSWArray;

@end

@implementation CSSWViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    
    _CSSWArray = @[@{@"children":@[@{@"level3":@"zzssmsl",@"value":@"税目税率"},@{@"level3":@"zzsynse",@"value":@"应纳税额"},@{@"level3":@"zzssbbtb",@"value":@"申报表填报"},@{@"level3":@"zzsssyh",@"value":@"税收优惠"},@{@"level3":@"zzsqt",@"value":@"其他"}],@"level2":@"zzs",@"value":@"增值税"},
  
        @{@"children":@[@{@"level3":@"srl",@"value":@"收入类"},@{@"level3":@"kcl",@"value":@"扣除类"},@{@"level3":@"zcl",@"value":@"资产类"},@{@"level3":@"tssxl",@"value":@"特殊事项类"},@{@"level3":@"qysdsssyh",@"value":@"税收优惠"},@{@"level3":@"qysdssbbtx",@"value":@"申报表填写"},@{@"level3":@"qysdsqt",@"value":@"其他"}],@"level2":@"qysds",@"value":@"企业所得税"},
                   
        @{@"children":@[@{@"level3":@"grsdssmsl",@"value":@"税目税率"},@{@"level3":@"grsdsynse",@"value":@"应纳税额"},@{@"level3":@"grsdssbbtx",@"value":@"申报表填写"},@{@"level3":@"grsdsssyh",@"value":@"税收优惠"},@{@"level3":@"grsdsqt",@"value":@"其他"}],@"level2":@"grsds",@"value":@"个人所得税"},
                   
        @{@"children":@[@{@"level3":@"tdzzs",@"value":@"土地增值税"},@{@"level3":@"xfs",@"value":@"消费税"},@{@"level3":@"fjsf",@"value":@"附加税费"},@{@"level3":@"yhs",@"value":@"印花税"},@{@"level3":@"qtszqt",@"value":@"其他税费"}],@"level2":@"qtsz",@"value":@"其他税种"},
                   
        @{@"children":@[@{@"level3":@"kjgd",@"value":@"会计规定"},@{@"level3":@"kjcl",@"value":@"会计处理"},@{@"level3":@"bbtz",@"value":@"报表填制"},@{@"level3":@"kjswqt",@"value":@"其他"}],@"level2":@"kjsw",@"value":@"会计实务"},
                   
        @{@"children":@[@{@"level3":@"fpkj",@"value":@"发票开具"},@{@"level3":@"fpqd",@"value":@"发票取得"},@{@"level3":@"fpdk",@"value":@"发票抵扣"},@{@"level3":@"fpzf",@"value":@"发票作废"}],@"level2":@"fpgl",@"value":@"发票管理"}];
    [WShareUtil sharedData].arrList = _CSSWArray;
    
    if (seachView == nil) {
        
        if (XIPHONE) {
            seachView = [[CouseSeachListView alloc]initWithFrame:CGRectMake(0, 0, WSCREENH_WIDTH, WSCREENH_HEIGHT - 49 - 64 - 50)];
        }else{
            seachView = [[CouseSeachListView alloc]initWithFrame:CGRectMake(0, 0, WSCREENH_WIDTH, WSCREENH_HEIGHT - 49 - 64)];
        }
        
        seachView.delegate = self;
        [self.view addSubview:seachView];
    }
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)btnOfpassValueClicked:(UIButton *)sender {
    
    _level1 = @"tax";
    WLog(@"%ld",(long)sender.tag);
    
    NSString *tagStr = [NSString stringWithFormat:@"%ld",(long)sender.tag];
    m = [[tagStr substringToIndex:1] intValue] - 1;
    n = [[tagStr substringFromIndex:tagStr.length-1] intValue];
    
    WLog(@"十位-%d",m);
    WLog(@"个位-%d",n);
    
    _level2 = [_CSSWArray[m] objectForKey:@"level2"];
    NSArray *arr = [_CSSWArray[m] objectForKey:@"children"];
    _level3 = [arr[n] objectForKey:@"level3"];
    //    _level3 = [[[WShareUtil sharedData].arrList[0] objectForKey:@"children"][0] objectForKey:@"level3"];
    
    WLog(@"_level1-%@",_level1);
    WLog(@"_level2-%@",_level2);
    WLog(@"_level3-%@",_level3);
    
    AnswerSortListViewController *aslVC = [[AnswerSortListViewController alloc]init];
    aslVC.level1 = _level1;
    aslVC.level2 = _level2;
    aslVC.level3 = _level3;
    aslVC.navTitle = [arr[n] objectForKey:@"value"];
    [self.navigationController pushViewController:aslVC animated:YES];
}

//点击隐藏list搜索
- (void)btnOfDisappearClicked {
}

@end
